home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AmigActive 10
/
AACD 10.iso
/
AACD
/
Programming
/
AmigaTalk
/
Intuition
/
Painter.st
< prev
next >
Wrap
Text File
|
2000-05-08
|
4KB
|
171 lines
"----------------------------------------------------"
" Painter Class implements simple graphics primitives"
"----------------------------------------------------"
Class Painter :Glyph
! frontPen backPen otherPen drawMode x y ownerWindow !
[
setAPen: pen
<primitive 200 0 ownerWindow pen>.
frontPen <- pen
|
setBPen: pen
<primitive 200 1 ownerWindow pen>.
backPen <- pen
|
setOPen: pen
<primitive 200 2 ownerWindow pen>.
otherPen <- pen
|
setDrawMode: mode
<primitive 200 3 ownerWindow mode>.
drawMode <- mode
|
getPens
^ frontPen @ backPen
|
getOPen
^ otherPen
|
getDrawMode
^ drawMode
|
location
^ x @ y
|
ownerIs
^ ownerWindow
|
movePenTo: newPoint
x <- newPoint x.
y <- newPoint y.
<primitive 200 4 ownerWindow x y>
|
drawTo: aPoint
x <- aPoint x.
y <- aPoint y.
<primitive 200 5 ownerWindow x y>
|
drawLineFrom: fPoint to: tPoint
x <- tPoint x.
y <- tPoint y.
<primitive 200 6 ownerWindow (fPoint x) (fPoint y) x y>
|
drawBoxFrom: fPoint to: tPoint
<primitive 200 7 ownerWindow (fPoint x) (fPoint y) (tPoint x) (tPoint y)>
|
drawCircle: cPoint radius: r
<primitive 200 9 ownerWindow (cPoint x) (cPoint y) r r>
|
drawEllipse: cPoint minaxis: a maxaxis: b
<primitive 200 9 ownerWindow (cPoint x) (cPoint y) a b>
|
drawPolygon: borderName
<primitive 200 10 ownerWindow borderName>
|
drawPixelAt: aPoint
x <- aPoint x.
y <- aPoint y.
<primitive 200 11 ownerWindow x y>
|
drawText: text at: aPoint
<primitive 200 19 ownerWindow text (aPoint x ) (aPoint y)>
|
new: newOwnerWindow
ownerWindow <- newOwnerWindow.
frontPen <- 1.
backPen <- 0.
otherPen <- 2.
drawMode <- 0. "JAM1 == 0"
x <- 0.
y <- 0.
^ self
]
"----------------------------------------------------"
" Image Class implements Image graphics primitives "
"----------------------------------------------------"
Class Image :Glyph
! leftEdge topEdge width height depth
planePick planeOnOff nextImage ownerWindow imageName
!
[
ownerIs
^ ownerWindow
|
getStartPoint
leftEdge <- <primitive 200 14 ownerWindow 0 imageName>.
topEdge <- <primitive 200 14 ownerWindow 1 imageName>.
^ leftEdge @ topEdge
|
getImageSize
width <- <primitive 200 14 ownerWindow 2 imageName>.
height <- <primitive 200 14 ownerWindow 3 imageName>.
^ width @ height
|
setOrigin: aPoint ! x y !
x <- aPoint x.
y <- aPoint y.
<primitive 200 15 ownerWindow 0 x imageName>.
<primitive 200 15 ownerWindow 1 y imageName>.
leftEdge <- x.
topEdge <- y
|
setExtent: sizePoint ! w h !
w <- sizePoint x.
h <- sizePoint y.
<primitive 200 15 ownerWindow 2 w imageName>.
<primitive 200 15 ownerWindow 3 h imageName>.
width <- w.
height <- h
|
setImageDepth: d
<primitive 200 15 ownerWindow 4 d imageName>.
depth <- d
|
addImage: w height: h depth: d
<primitive 200 13 ownerWindow w h d imageName>
|
drawImageAt: aPoint
<primitive 200 16 ownerWindow (aPoint x) (aPoint y) imageName>
|
setImageDataFrom: imageFile
<primitive 200 17 ownerWindow imageFile imageName>
|
getImageDepth
^ depth <- <primitive 200 14 ownerWindow 4 imageName>
|
getImagePlanePick
^ planePick <- <primitive 200 14 ownerWindow 6 imageName>
|
getImagePlaneOnOff
^ planeOnOff <- <primitive 200 14 ownerWindow 7 imageName>
|
getNextImage
^ nextImage <- <primitive 200 14 ownerWindow 8 imageName>
|
setImagePlanePick: pp
<primitive 200 15 ownerWindow 6 pp imageName>.
planePick <- pp
|
setImagePlaneOnOff: po
<primitive 200 15 ownerWindow 7 po imageName>.
planeOnOff <- po
|
setNextImage: newNextImage
<primitive 200 15 ownerWindow 8 newNextImage imageName>.
nextImage <- newNextImage
|
new: newImageName
imageName <- newImageName.
^ self
|
registerTo: newWindowName
ownerWindow <- newWindowName.
<primitive 200 18 ownerWindow imageName>
|
removeImage
<primitive 200 12 ownerWindow imageName>
]